package com.iefgames.cs.utils;

import java.io.File;

import org.apache.commons.lang.StringUtils;

public final class DirectoryUtil {
	private final static String DOT = ".";
	
	private final static String CLASS_SUFFIX  = DOT + "class";
	
	public final static String SERVER_PATH = getServerPath();
	
	private static String getServerPath() {
		Class c = DirectoryUtil.class;
		String resourcePath = c.getResource(c.getSimpleName() + CLASS_SUFFIX).toString()
		.replace("file:", StringUtils.EMPTY);
		String classInContextPath = c.getName().replace(DOT, StringUtils.EMPTY + File.separatorChar) + CLASS_SUFFIX;

		return resourcePath.replace(File.separatorChar + classInContextPath, StringUtils.EMPTY).replace("WEB-INF/classes", "");
	}
}
